//
//  SWNotPayTableViewCell.m
//  PropertyManager
//
//  Created by 黎世炜 on 2018/11/6.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "SWNotPayTableViewCell.h"

@interface SWNotPayTableViewCell()
    @property (weak, nonatomic) IBOutlet UILabel *timeLabel;
    @property (weak, nonatomic) IBOutlet UILabel *moneyLabel;
    @property (weak, nonatomic) IBOutlet UILabel *statusLabel;
    
@end

@implementation SWNotPayTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)setModel:(NotPayModel *)model{
    _model = model;
    NSArray * strArr = [model.keyStr componentsSeparatedByString:@"#"];
    self.timeLabel.text = strArr[0];
    self.moneyLabel.text = [NSString stringWithFormat:@"¥%.2lf",model.money];
    NSString * statusStr = strArr[3];
    if ([statusStr isEqualToString:@"0"]) {//本期待缴
        self.statusLabel.text = @"代缴费";
        self.statusLabel.backgroundColor = [UIColor colorWithRed:30/255.0 green:100/255.0 blue:228/255.0 alpha:1];
        self.statusLabel.textColor =  kColorFromHex(0x1E64E4);
    }
    
    if ([statusStr isEqualToString:@"1"]) {//逾期未缴
        self.statusLabel.text = @"逾期未交";
        self.statusLabel.backgroundColor = kColorFromHex(0xFF0000);
        self.statusLabel.textColor =  kColorFromHex(0xffffff);
    }
    self.statusLabel.layer.masksToBounds = YES;
    self.statusLabel.layer.cornerRadius = 10;
}

-(void)setHistoryModel:(NotPayModel *)historyModel{
    _historyModel = historyModel;
    NSArray * strArr = [historyModel.keyStr componentsSeparatedByString:@"#"];
    self.timeLabel.text = strArr[0];
    self.moneyLabel.text = [NSString stringWithFormat:@"¥%.2lf",historyModel.money];
    NSString * statusStr = strArr[3];
    if ([statusStr isEqualToString:@"0"]) {//本期待缴
        self.statusLabel.text = @"代缴费";
        self.statusLabel.backgroundColor = [UIColor colorWithRed:30/255.0 green:100/255.0 blue:228/255.0 alpha:1];
        self.statusLabel.textColor =  kColorFromHex(0x1E64E4);
    }
    
    if ([statusStr isEqualToString:@"1"]) {//逾期未缴
        self.statusLabel.text = @"逾期未交";
        self.statusLabel.backgroundColor = kColorFromHex(0xFF0000);
        self.statusLabel.textColor =  kColorFromHex(0xffffff);
    }
    
    if ([statusStr isEqualToString:@"2"]) {//逾期未缴
        self.statusLabel.text = @"已缴费";
        self.statusLabel.backgroundColor = [UIColor colorWithRed:36/255.0 green:191/255.0 blue:36/255.0 alpha:1];;
        self.statusLabel.textColor =  kColorFromHex(0xffffff);
    }
    self.statusLabel.layer.masksToBounds = YES;
    self.statusLabel.layer.cornerRadius = 10;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
